// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.skinnedmodel.advancedanimation;

import zombie.core.math.PZMath;
import zombie.util.StringUtils;

public final class AnimationVariableSlotString extends AnimationVariableSlot {
    private String m_value;

    public AnimationVariableSlotString(String key) {
        super(key);
    }

    @Override
    public String getValueString() {
        return this.m_value;
    }

    @Override
    public float getValueFloat() {
        return PZMath.tryParseFloat(this.m_value, 0.0F);
    }

    @Override
    public boolean getValueBool() {
        return StringUtils.tryParseBoolean(this.m_value);
    }

    @Override
    public void setValue(String val) {
        this.m_value = val;
    }

    @Override
    public void setValue(float val) {
        this.m_value = String.valueOf(val);
    }

    @Override
    public void setValue(boolean val) {
        this.m_value = val ? "true" : "false";
    }

    @Override
    public AnimationVariableType getType() {
        return AnimationVariableType.String;
    }

    @Override
    public boolean canConvertFrom(String val) {
        return true;
    }

    @Override
    public void clear() {
        this.m_value = "";
    }
}
